package com.hmall.client;

import com.hmall.dto.PageDTO;
import com.hmall.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;

/**
 * 商品微服务远程调用
 */
@FeignClient("itemservice")
public interface ItemClient {

    @GetMapping("/item/{id}")
    public Item getById(@PathVariable Long id);

    @PutMapping("/item/stock/{itemId}/{num}")
    public void deductItemNum(@PathVariable("itemId") Long itemId,@PathVariable("num") Integer num);

    @PutMapping("/item/refund/{itemId}/{num}")
    public void refund(@PathVariable("itemId") String itemId,@PathVariable("num") String num);

    @GetMapping("/item/list/{page}/{size}")
    public PageDTO<Item> pageQuery(@PathVariable(value = "page") Integer page, @PathVariable(value = "size") Integer size);
}
